package com.thinvent.nj.ais.entity;

import com.thinvent.nj.common.util.DateUtil;
import com.thinvent.nj.mybatis.entity.BaseOracleEntity;

import java.util.Date;


/**
 * 日志实体
 *
 * 用于记录系统操作日志
 *
 */
public class Log extends BaseOracleEntity {

    /**
     * 客户端IP
     */
    private String ip;

    /**
     * 请求uri
     */
    private String uri;

    /**
     * 请求类型（1： ajax; 2: 普通请求）
     */
    private String type;

    /**
     * 请求方法(GET; POST; PUT; DELETE）
     */
    private String method;

    /**
     * 请求参数（JSON）
     */
    private String params;

    /**
     * 请求时用户名
     */
    private String username;

    /**
     * 请求发起时间
     */
    private Date reqDate;

    /**
     * 请求耗时
     */
    private Long costMills;


    /**
     * http 标准响应码
     */
    private Integer statusCode;

    /**
     * 响应结果
     */
    private String repData;


    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getUri() {
        return uri;
    }

    public void setUri(String uri) {
        this.uri = uri;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public String getParams() {
        return params;
    }

    public void setParams(String params) {
        this.params = params;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public Date getReqDate() {
        return reqDate;
    }

    public void setReqDate(Date reqDate) {
        this.reqDate = reqDate;
    }

    public Long getCostMills() {
        return costMills;
    }

    public void setCostMills(Long costMills) {
        this.costMills = costMills;
    }

    public String getRepData() {
        return repData;
    }

    public void setRepData(String repData) {
        this.repData = repData;
    }

    public Integer getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(Integer statusCode) {
        this.statusCode = statusCode;
    }


    @Override
    public String toString() {
        return "Log {" +
                "ip='" + ip + '\'' +
                ", uri='" + uri + '\'' +
                ", type='" + ("1".equals(type) ? "ajax" : "普通请求") + '\'' +
                ", method='" + method + '\'' +
                ", params='" + params + '\'' +
                ", username='" + username + '\'' +
                ", reqDate=" + DateUtil.toChar(reqDate) +
                ", costMills=" + costMills + " millis" +
                ", statusCode=" + statusCode +
                ", repData='" + repData + '\'' +
                '}';
    }
}
